package com.unidt.www.module.bpm.controller.admin.task;

import com.unidt.www.framework.common.pojo.CommonResult;
import com.unidt.www.module.bpm.controller.admin.task.vo.task.*;
import com.unidt.www.module.bpm.service.task.BpmStatisticsService;
import com.unidt.www.module.bpm.vo.ProcessCategoryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.unidt.www.framework.common.pojo.CommonResult.success;

/**
 * @Author sk
 * @Description:
 * @Date 2022/12/1 15:46
 **/
@Api(tags = "管理后台 - 流程统计")
@RestController
@RequestMapping("/bpm/task-statistics")
public class BpmStatisticsController {

   @Autowired
   BpmStatisticsService bpmStatisticsService;


    @GetMapping("/getHourDurationDateLine")
    @ApiOperation(value = "任务耗时-日走势")
    public CommonResult<HourDurationDateVo> getHourDurationDateLine() {

        return success( this.bpmStatisticsService.getHourDurationDateLine());
    }

    @GetMapping("/getProcessModelDue")
    @ApiOperation(value = "流程待办分类统计")
    public CommonResult<List<ProcessCategoryVo>> getProcessModelDue() {

        return success( this.bpmStatisticsService.getProcessModelDue());
    }


    @GetMapping("/getDeptTaskInfo")
    @ApiOperation(value = "部门完成情况")
    public CommonResult<DeptTaskInfoVo> getDeptTaskInfo() {

        return success( this.bpmStatisticsService.getDeptTaskInfo());
    }




    @GetMapping("/getMyTask")
    @ApiOperation(value = "我的流程")
    public CommonResult<MyTaskVo> getMyTask() {

        /**
         * 我的待办数量
         * 延期数量
         * 办结数量
         */
        return success(bpmStatisticsService.getMyTask());
    }

    @GetMapping("/getUserTaskLine")
    @ApiOperation(value = "获取用户流程处理数量走势")
    public CommonResult<TaskDayLineVo> getUserTaskLine() {
        return success(bpmStatisticsService.getUserTaskLine());
    }




    @GetMapping("/getTimeOutLine")
    @ApiOperation(value = "逾期统计走势")
    public CommonResult<TaskTimeOutLineVo> getTimeOutLine() {
        return success(bpmStatisticsService.getTimeOutLine());
    }



}
